Skip to content

fix: replace bare except clauses in dataset loading#139

Open
Mr-Neutr0n wants to merge 1 commit intoVchitect:mainfrom
Mr-Neutr0n:fix/bare-except-clauses
Open

fix: replace bare except clauses in dataset loading#139
Mr-Neutr0n wants to merge 1 commit intoVchitect:mainfrom
Mr-Neutr0n:fix/bare-except-clauses

Conversation

@Mr-Neutr0n
Copy link
Copy Markdown

Bug

Bare except: clauses in the dataset loading code (datasets/taichi_datasets.py, datasets/sky_datasets.py, datasets/taichi_image_datasets.py, datasets/sky_image_datasets.py) catch all exceptions including KeyboardInterrupt and SystemExit. This silently swallows errors during data loading and makes debugging very difficult.

The try blocks wrap a sorted() call with a lambda that calls int() on parts of the filename. When filenames don't match the expected pattern, int() raises ValueError, which is the only expected exception here.

Fix

Replaced bare except: with except ValueError: to only catch the expected exception from int() conversion failures, allowing unexpected errors to propagate normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant